//
//  LJFCommentsCell.m
//  SevenZhou
//
//  Created by qianfeng on 15/9/22.
//  Copyright (c) 2015年 ljf. All rights reserved.
//

#import "LJFCommentsCell.h"
#import "UIImageView+AFNetworking.h"

@implementation LJFCommentsCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setPicArr:(NSArray *)picArr
{
    _picArr = picArr;
        
    NSInteger count = picArr.count;
    
    for (NSInteger i = 0; i  < count; i++)
    {
        UIImageView *imgview = (UIImageView *)[self viewWithTag:300 + i];
        imgview.hidden = NO;
        [imgview setImageWithURL:[NSURL URLWithString:picArr[i]] placeholderImage:[UIImage imageNamed:@"default_image.png"]];
        imgview.layer.cornerRadius = 20;
    }
    
    for (NSInteger i = count; i<8; i++)
    {
        UIImageView *imgview = (UIImageView *)[self viewWithTag:300 + i];
        imgview.hidden = YES;
    }
}

- (void)setRecontentStr:(NSString *)recontentStr
{
    _recontentStr = recontentStr;
    
     CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
    CGFloat width = (screenWidth - 100 - 15)/4.0;
    
    if (_recontentStr.length > 0)
    {
        _reContent.hidden = NO;
        
        if (_picArr.count == 0)
        {
            _re_contenY.constant = _contentH + 30 + 5;
            
        }else if(_picArr.count <= 4)
        {
            _re_contenY.constant = _contentH + 30 + width + 10;
        }
        else
        {
            _re_contenY.constant = _contentH + 30 + width*2 + 10 + 5;
        }
    }
    else
    {
        _reContent.hidden = YES;
    }
}

@end
